<?php

class Com_domain extends Acan{
	function __construct($ainfo=null){
		parent::__construct($ainfo=null);
		$this->model = Afun_db()->model(Acan_table_domain);
		$this->uid = $_SESSION['auser']['uid'];
	}
	//验证域名是否为登入用户
	function chk_domain($id){
		$data = $this->model->ofindPk($id);
		if($data->uid != $this->uid || $data->if_del == 1){exit('该域名不是您的');}
		return true;
	}
	//保存域名信息
	function save($obj){
		$this->chk_domain($obj->id);
		$html->error = 0;
		if($_POST){
			$save = $_POST['save'];
			$save['id'] = $obj->id;
			if($save['type']!=1){
				
			}
			$html->rs = Afun_db()->model(Acan_table_domain)->save($save);
			$html->error = 0;
			Afun_file_rmdirm(A_ROOT.'/temp/domain/'.$save['domain']);
			$html->msg = '保存成功';
			
		}else{$html->msg = '错误的操作';$html->error = 1;}
		return $html;
	}
	
	
}
?>